package com.neuronbit.businessflow.intellij.model;

import org.apache.commons.lang3.StringUtils;

/**
 * The type Type.
 */
public interface Type {

    /**
     * Is simple type boolean.
     *
     * @return the boolean
     */
    default boolean isSimpleType() {
        if (null == getQualifiedName()) {
            return true;
        }
        if (StringUtils.startsWithAny(getQualifiedName(), "java.lang", "java.math")) {
            return true;
        }
        if (!getQualifiedName().contains(".")) {
            return true;
        }
        if (StringUtils.equalsAny(getName(), "boolean", "int", "long", "float", "double")) {
            return true;
        }
        return false;
    }

    /**
     * Gets name.
     *
     * @return the name
     */
    String getQualifiedName();

    /**
     * Gets simple name.
     *
     * @return the simple name
     */
    String getName();

    /**
     * Is void boolean.
     *
     * @return the boolean
     */
    default boolean isVoid() {
        return "void".equals(getName()) || "void".equals(getQualifiedName());
    }
}
